package com.sdutcm.Mapper;

/*
 *@Author Yan
 *@Create 2019-08-24 10:25
 */

import com.sdutcm.Domain.Attendance;
import com.sdutcm.Domain.Attendance2;
import com.sdutcm.Domain.Student;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;


public interface AttMapper {


    @Select("SELECT s_name,s_id,s_leisure_${id} FROM student WHERE (s_leisure_${id} = 12 or s_leisure_${id} = 1 or s_leisure_${id} = 2) and s_exit = 0 and s_id NOT IN (SELECT s_id from attendance_student WHERE a_id = 'one_${id}' or a_id = 'two_${id}')")
    public List<Student> attfind(Integer id) throws Exception;



//    @Insert("insert into attendance_student(one_1,one_2,one_3,one_4,one_5,one_6,one_7,one_8,one_9,one_10,one_11,one_12,one_13,one_14,one_15) value(#{one_1},#{one_2},#{one_3},#{one_4},#{one_5},#{one_6},#{one_7},#{one_8},#{one_9},#{one_10},#{one_11},#{one_12},#{one_13},#{one_14},#{one_15})")

    @Insert("insert into attendance_student(a_id,s_id) value('one_1',#{one_1})")
    public void attendance_studentedit1(Attendance attendance)throws Exception;

    @Insert("insert into attendance_student(a_id,s_id) value('one_2',#{one_2})")
    public void attendance_studentedit2(Attendance attendance)throws Exception;

    @Insert("insert into attendance_student(a_id,s_id) value('one_3',#{one_3})")
    public void attendance_studentedit3(Attendance attendance)throws Exception;

    @Insert("insert into attendance_student(a_id,s_id) value('one_4',#{one_4})")
    public void attendance_studentedit4(Attendance attendance)throws Exception;

    @Insert("insert into attendance_student(a_id,s_id) value('one_5',#{one_5})")
    public void attendance_studentedit5(Attendance attendance)throws Exception;

    @Insert("insert into attendance_student(a_id,s_id) value('one_6',#{one_6})")
    public void attendance_studentedit6(Attendance attendance)throws Exception;

    @Insert("insert into attendance_student(a_id,s_id) value('one_7',#{one_7})")
    public void attendance_studentedit7(Attendance attendance)throws Exception;

    @Insert("insert into attendance_student(a_id,s_id) value('one_8',#{one_8})")
    public void attendance_studentedit8(Attendance attendance)throws Exception;

    @Insert("insert into attendance_student(a_id,s_id) value('one_9',#{one_9})")
    public void attendance_studentedit9(Attendance attendance)throws Exception;

    @Insert("insert into attendance_student(a_id,s_id) value('one_10',#{one_10})")
    public void attendance_studentedit10(Attendance attendance)throws Exception;

    @Insert("insert into attendance_student(a_id,s_id) value('one_11',#{one_11})")
    public void attendance_studentedit11(Attendance attendance)throws Exception;

    @Insert("insert into attendance_student(a_id,s_id) value('one_12',#{one_12})")
    public void attendance_studentedit12(Attendance attendance)throws Exception;

    @Insert("insert into attendance_student(a_id,s_id) value('one_13',#{one_13})")
    public void attendance_studentedit13(Attendance attendance)throws Exception;

    @Insert("insert into attendance_student(a_id,s_id) value('one_14',#{one_14})")
    public void attendance_studentedit14(Attendance attendance)throws Exception;

    @Insert("insert into attendance_student(a_id,s_id) value('one_15',#{one_15})")
    public void attendance_studentedit15(Attendance attendance)throws Exception;

//-------------------------------------------------------------------------------------------
@Insert("insert into attendance_student(a_id,s_id) value('two_1',#{two_1})")
public void attendance_studentedit01(Attendance attendance)throws Exception;

    @Insert("insert into attendance_student(a_id,s_id) value('two_2',#{two_2})")
    public void attendance_studentedit02(Attendance attendance)throws Exception;

    @Insert("insert into attendance_student(a_id,s_id) value('two_3',#{two_3})")
    public void attendance_studentedit03(Attendance attendance)throws Exception;

    @Insert("insert into attendance_student(a_id,s_id) value('two_4',#{two_4})")
    public void attendance_studentedit04(Attendance attendance)throws Exception;

    @Insert("insert into attendance_student(a_id,s_id) value('two_5',#{two_5})")
    public void attendance_studentedit05(Attendance attendance)throws Exception;

    @Insert("insert into attendance_student(a_id,s_id) value('two_6',#{two_6})")
    public void attendance_studentedit06(Attendance attendance)throws Exception;

    @Insert("insert into attendance_student(a_id,s_id) value('two_7',#{two_7})")
    public void attendance_studentedit07(Attendance attendance)throws Exception;

    @Insert("insert into attendance_student(a_id,s_id) value('two_8',#{two_8})")
    public void attendance_studentedit08(Attendance attendance)throws Exception;

    @Insert("insert into attendance_student(a_id,s_id) value('two_9',#{two_9})")
    public void attendance_studentedit09(Attendance attendance)throws Exception;

    @Insert("insert into attendance_student(a_id,s_id) value('two_10',#{two_10})")
    public void attendance_studentedit010(Attendance attendance)throws Exception;

    @Insert("insert into attendance_student(a_id,s_id) value('two_11',#{two_11})")
    public void attendance_studentedit011(Attendance attendance)throws Exception;

    @Insert("insert into attendance_student(a_id,s_id) value('two_12',#{two_12})")
    public void attendance_studentedit012(Attendance attendance)throws Exception;

    @Insert("insert into attendance_student(a_id,s_id) value('two_13',#{two_13})")
    public void attendance_studentedit013(Attendance attendance)throws Exception;

    @Insert("insert into attendance_student(a_id,s_id) value('two_14',#{two_14})")
    public void attendance_studentedit014(Attendance attendance)throws Exception;

    @Insert("insert into attendance_student(a_id,s_id) value('two_15',#{two_15})")
    public void attendance_studentedit015(Attendance attendance)throws Exception;
//-------------------------------------------------------------------------------------------
    //表格显示
    @Select("SELECT s.s_name,a.a_id,s.s_leisure_${id},s.s_id FROM attendance_student a INNER JOIN student s ON a.s_id = s.s_id WHERE s_leisure_${id} != 0 AND a_id = 'one_${id}'")
    public List<Attendance2> att1201list(Integer id);

//    行政楼表格显示
    @Select("SELECT s.s_name,a.a_id,s.s_leisure_${id},s.s_id FROM attendance_student a INNER JOIN student s ON a.s_id = s.s_id WHERE s_leisure_${id} != 0 AND a_id = 'two_${id}'")
    public List<Attendance2> att1201listA(Integer id);


//    清除表格null
    @Delete("delete from attendance_student where s_id is null")
    public void clearup() throws Exception;

    //清除排班信息
    @Delete("delete from attendance_student")
    public void declearTable() throws Exception;

//    删除值班人员
    @Delete("delete from attendance_student where s_id = #{s_id} and a_id = #{a_id}")
    public void attdeleteById(String s_id,String a_id)throws Exception;


}
